package wechat.bean.response.message.receive;

import org.dom4j.DocumentException;

import wechat.bean.response.MessageBaseBean;

/**
 * 文本消息
 * 
 *
 */
public class ReceiveTextBean extends MessageBaseBean {
	private String Content;
	
	public ReceiveTextBean(String str) throws DocumentException {
		super(str);
		super.setMsgType(Receive_Message_Text);
	}
	
	public ReceiveTextBean(){
		super.setMsgType(Receive_Message_Text);
	}

	public String getContent() {
		return Content;
	}

	public void setContent(String content) {
		Content = content;
	}
	
	protected static final String Xpath_Content = "/xml/Content";
	
	public void transform() throws Exception {
		super.transform();
		this.setContent(getNodeText(Xpath_Content));
	}
	
	
//	public String buildXml() throws Exception {
//		super.buildXml();
//		super.addNode("Content", getContent());
//		return parent.asXML();
//	}

	
	
	
	
	
	public static void main(String[] args) throws Exception {
		String str = "<xml><ToUserName><![CDATA[toUser]]></ToUserName><FromUserName><![CDATA[fromUser]]></FromUserName><CreateTime>12345678</CreateTime><MsgType><![CDATA[text]]></MsgType><Content><![CDATA[你好]]></Content></xml>";
		ReceiveTextBean textMessageBean = new ReceiveTextBean(str);
		textMessageBean.transform();
		System.out.println(textMessageBean.getMsgType());
		
//		TextMessageBean textMessageBean = new TextMessageBean();
//		textMessageBean.setToUserName("1");
//		textMessageBean.setFromUserName("23");
//		textMessageBean.setCreateTime(1134234L);
//		textMessageBean.setContent("111");
//		System.out.println(textMessageBean.buildXml());
	}
}
